package cn.xianyang.feignclient;


import cn.xianyang.domain.Movie;
import cn.xianyang.utils.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class MovieFeignClientFallbackFactory implements FallbackFactory<MovieFeignClient> {

    @Override
    public MovieFeignClient create(Throwable throwable) {
        return new MovieFeignClient() {
            @Override
            public AjaxResult findAll() {
                return new AjaxResult(false,"网络错误，请稍后再试",null);
            }

            @Override
            public AjaxResult buyTickets(Map map) {
                return new AjaxResult(false,"网络错误，请稍后再试",null);
            }

            @Override
            public Movie findById(Long id) {
                return null;
            }

            @Override
            public AjaxResult watch(Long id) {
                return new AjaxResult(false,"网络错误，请稍后再试",null);
            }

            @Override
            public Movie findMaxTicket() {
                return null;
            }
        };
    }
}
